<!doctype html>

<html>
<head>
  <link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon">
  <title>error.js (Closure Library API Documentation - JavaScript)</title>
  <link rel="stylesheet" href="static/css/base.css">
  <link rel="stylesheet" href="static/css/doc.css">
  <link rel="stylesheet" href="static/css/sidetree.css">
  <link rel="stylesheet" href="static/css/prettify.css">

  <script>
     var _staticFilePath = "static/";
     var _typeTreeName = "goog";
     var _fileTreeName = "Source";
  </script>

  <script src="static/js/doc.js">
  </script>


  <meta charset="utf8">
</head>

<body onload="grokdoc.onLoad();">

<div id="header">
  <div class="g-section g-tpl-50-50 g-split">
    <div class="g-unit g-first">
      <a id="logo" href="index.html">Closure Library API Documentation</a>
    </div>

    <div class="g-unit">
      <div class="g-c">
        <strong>Go to class or file:</strong>
        <input type="text" id="ac">
      </div>
    </div>
  </div>
</div>

<div class="clear"></div>

<h2><a href="closure_goog_fs_error.js.html">error.js</a></h2>

<pre class="prettyprint lang-js">
<a name="line1"></a>// Copyright 2011 The Closure Library Authors. All Rights Reserved.
<a name="line2"></a>//
<a name="line3"></a>// Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
<a name="line4"></a>// you may not use this file except in compliance with the License.
<a name="line5"></a>// You may obtain a copy of the License at
<a name="line6"></a>//
<a name="line7"></a>//      http://www.apache.org/licenses/LICENSE-2.0
<a name="line8"></a>//
<a name="line9"></a>// Unless required by applicable law or agreed to in writing, software
<a name="line10"></a>// distributed under the License is distributed on an &quot;AS-IS&quot; BASIS,
<a name="line11"></a>// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<a name="line12"></a>// See the License for the specific language governing permissions and
<a name="line13"></a>// limitations under the License.
<a name="line14"></a>
<a name="line15"></a>/**
<a name="line16"></a> * @fileoverview A wrapper for the HTML5 FileError object.
<a name="line17"></a> *
<a name="line18"></a> */
<a name="line19"></a>
<a name="line20"></a>goog.provide(&#39;goog.fs.Error&#39;);
<a name="line21"></a>goog.provide(&#39;goog.fs.Error.ErrorCode&#39;);
<a name="line22"></a>
<a name="line23"></a>goog.require(&#39;goog.debug.Error&#39;);
<a name="line24"></a>goog.require(&#39;goog.string&#39;);
<a name="line25"></a>
<a name="line26"></a>
<a name="line27"></a>
<a name="line28"></a>/**
<a name="line29"></a> * A filesystem error. Since the filesystem API is asynchronous, stack traces
<a name="line30"></a> * are less useful for identifying where errors come from, so this includes a
<a name="line31"></a> * large amount of metadata in the message.
<a name="line32"></a> *
<a name="line33"></a> * @param {number} code The error code for the error.
<a name="line34"></a> * @param {string} action The action being undertaken when the error was raised.
<a name="line35"></a> * @constructor
<a name="line36"></a> * @extends {goog.debug.Error}
<a name="line37"></a> */
<a name="line38"></a>goog.fs.Error = function(code, action) {
<a name="line39"></a>  goog.base(this, goog.string.subs(&#39;Error %s: %s&#39;, action,
<a name="line40"></a>                                   goog.fs.Error.getDebugMessage(code)));
<a name="line41"></a>  this.code = /** @type {goog.fs.Error.ErrorCode} */ (code);
<a name="line42"></a>};
<a name="line43"></a>goog.inherits(goog.fs.Error, goog.debug.Error);
<a name="line44"></a>
<a name="line45"></a>
<a name="line46"></a>/**
<a name="line47"></a> * Error codes for file errors.
<a name="line48"></a> * @see http://www.w3.org/TR/file-system-api/#idl-def-FileException
<a name="line49"></a> *
<a name="line50"></a> * @enum {number}
<a name="line51"></a> */
<a name="line52"></a>goog.fs.Error.ErrorCode = {
<a name="line53"></a>  NOT_FOUND: 1,
<a name="line54"></a>  SECURITY: 2,
<a name="line55"></a>  ABORT: 3,
<a name="line56"></a>  NOT_READABLE: 4,
<a name="line57"></a>  ENCODING: 5,
<a name="line58"></a>  NO_MODIFICATION_ALLOWED: 6,
<a name="line59"></a>  INVALID_STATE: 7,
<a name="line60"></a>  SYNTAX: 8,
<a name="line61"></a>  INVALID_MODIFICATION: 9,
<a name="line62"></a>  QUOTA_EXCEEDED: 10,
<a name="line63"></a>  TYPE_MISMATCH: 11,
<a name="line64"></a>  PATH_EXISTS: 12
<a name="line65"></a>};
<a name="line66"></a>
<a name="line67"></a>
<a name="line68"></a>/**
<a name="line69"></a> * @param {number} errorCode The error code for the error.
<a name="line70"></a> * @return {string} A debug message for the given error code. These messages are
<a name="line71"></a> *     for debugging only and are not localized.
<a name="line72"></a> */
<a name="line73"></a>goog.fs.Error.getDebugMessage = function(errorCode) {
<a name="line74"></a>  switch (errorCode) {
<a name="line75"></a>    case goog.fs.Error.ErrorCode.NOT_FOUND:
<a name="line76"></a>      return &#39;File or directory not found&#39;;
<a name="line77"></a>    case goog.fs.Error.ErrorCode.SECURITY:
<a name="line78"></a>      return &#39;Insecure or disallowed operation&#39;;
<a name="line79"></a>    case goog.fs.Error.ErrorCode.ABORT:
<a name="line80"></a>      return &#39;Operation aborted&#39;;
<a name="line81"></a>    case goog.fs.Error.ErrorCode.NOT_READABLE:
<a name="line82"></a>      return &#39;File or directory not readable&#39;;
<a name="line83"></a>    case goog.fs.Error.ErrorCode.ENCODING:
<a name="line84"></a>      return &#39;Invalid encoding&#39;;
<a name="line85"></a>    case goog.fs.Error.ErrorCode.NO_MODIFICATION_ALLOWED:
<a name="line86"></a>      return &#39;Cannot modify file or directory&#39;;
<a name="line87"></a>    case goog.fs.Error.ErrorCode.INVALID_STATE:
<a name="line88"></a>      return &#39;Invalid state&#39;;
<a name="line89"></a>    case goog.fs.Error.ErrorCode.SYNTAX:
<a name="line90"></a>      return &#39;Invalid line-ending specifier&#39;;
<a name="line91"></a>    case goog.fs.Error.ErrorCode.INVALID_MODIFICATION:
<a name="line92"></a>      return &#39;Invalid modification&#39;;
<a name="line93"></a>    case goog.fs.Error.ErrorCode.QUOTA_EXCEEDED:
<a name="line94"></a>      return &#39;Quota exceeded&#39;;
<a name="line95"></a>    case goog.fs.Error.ErrorCode.TYPE_MISMATCH:
<a name="line96"></a>      return &#39;Invalid filetype&#39;;
<a name="line97"></a>    case goog.fs.Error.ErrorCode.PATH_EXISTS:
<a name="line98"></a>      return &#39;File or directory already exists at specified path&#39;;
<a name="line99"></a>    default:
<a name="line100"></a>      return &#39;Unrecognized error&#39;;
<a name="line101"></a>  }
<a name="line102"></a>};
</pre>


</body>
</html>
